<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=640px,user-scalable=no,target-densitydpi=device-dpi" />
		<link rel="stylesheet" href="../css/css.css" type="text/css" />
		<script type="text/javascript" src='../js/jquery.min.js'></script>
		<script type="text/javascript" src='../js/main_in.js'></script>
		<script type="text/javascript" src='../js/common.js'></script>
		<title></title>
		<script type="text/javascript">
			var hid = getUrlParam('hid');
			car_search();
			
			$(function(){
               
               $("#do_edit").click(function(){
                   
                   var PlateNo = $("#PlateNo").val();
                   var PlateNo2 = $("#PlateNo2").val();
                   var DriverName = $("#DriverName").val();
                   var Mobile = $("#Mobile").val();
                   
                   
                   if(PlateNo == ''){
                       alert("车牌号不能为空");
                        return false;
                   }
                   
                   
                   if(confirm("确认提交？")){
                       var wt=plus.nativeUI.showWaiting();
                        $.ajax({
                            url: "http://api.unair.cn/api/DriverBL?driverId=" + hid,
                            type: "POST",
                            data: {
                                "PlateNo": PlateNo,
                                "PlateNo2":PlateNo2,
                                "DriverName":DriverName,
                                "Mobile":Mobile
                            },
                            success: function (data) {
                            	wt.close();
                                if(data != null){
                                   
                                    var w=plus.nativeUI.showWaiting("提交成功");
									w.onclose=function(){
										clearInterval(t);
									}
									var t=setInterval(function(){
										w.setTitle("提交成功");
										w.close();
										clicked("addr_search.html?x=3");
										clearInterval(t);
									},2000);
                                }else{
                                    alert("提交失败")
                                }
                            },
                            error: function (data) {
                            	wt.close();
                                alert(JSON.stringify(data));
                            }

                        });
                    };
                   
                   
               });
               
               
            });
            
			function car_search(){
                $.ajax({
                    url: "http://api.unair.cn/api/DriverBL?userID=0&driverId=" + hid,
                    type: "GET",
                    data: {},
                    success: function(data) {
                        $.each(data, function(k, v) {
                            v.PlateNo2 = typeof (v.PlateNo2) == 'undefined' ? '' : v.PlateNo2;
                            v.PlateNo2 = v.PlateNo2 == null ? '' : v.PlateNo2;
                            v.DriverName = typeof (v.DriverName) == 'undefined' ? '' : v.DriverName;
                            v.DriverName = v.DriverName == null ? '' : v.DriverName;
                            v.Mobile = typeof (v.Mobile) == 'undefined' ? '' : v.Mobile;
                            v.Mobile = v.Mobile == null ? '' : v.Mobile;
                            $("#PlateNo").val(v.PlateNo);
                            $("#PlateNo2").val(v.PlateNo2);
                            $("#DriverName").val(v.DriverName);
                            $("#Mobile").val(v.Mobile);
                        });
                    },
                    error: function(data) {
//                        alert(data)
                    }
                });
            }
		</script>
	</head>
	<body>
		<div class="app_head">
            <div class="app_prev" onclick="clicked('addr_search.html')"><img src="../img/arrow.png" /></div>
            <div class="app_head_text" >司机信息修改</div>
            <div class="app_prev"></div>
        </div>
        <div class="app_body">
            <div class="main_in_input">
                <div class="main_in_input_text_left">车牌号：</div>
                <div class="main_in_input_input_right"><input type="text" id="PlateNo" value="" /></div>
            </div>
            <div class="main_in_input">
                <div class="main_in_input_text_left">车挂号：</div>
                <div class="main_in_input_input_right"><input type="text" id="PlateNo2" value="" /></div>
            </div>
            <div class="main_in_input">
                <div class="main_in_input_text_left">姓名：</div>
                <div class="main_in_input_input_right"><input type="text" id="DriverName" value="" /></div>
            </div>
            <div class="main_in_input">
                <div class="main_in_input_text_left">手机号：</div>
                <div class="main_in_input_input_right"><input type="text" id="Mobile" value="" /></div>
            </div>
            <div style="background: #fff;width: 100%;height: 100px;">
                <div class="bg_submit" id="do_edit">提&nbsp;交</div>
                <div class="bg_back_class" onclick="clicked('addr_search.html')">取&nbsp;消</div>
            </div>
        </div>
<div class="outside_pull"></div>
<img src="../img/loading.gif" class="fade_out_img" id="fade_out_loading" />
	</body>
</html>
